package com.lky.marshall.search.controller;

import com.lky.marshall.search.service.MallSearchService;
import com.lky.marshall.search.vo.SearchParams;
import com.lky.marshall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * Created by
 * autor : Marshall lky
 * datetime: 2021/4/15 20:42
 */
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParams searchParams,Model model){
        //1.根据传递来的页面的查询参数，去es中检索商品
        SearchResult res = mallSearchService.search(searchParams);
        model.addAttribute("result",res);
        return "list";
    }

}
